#!/usr/bin/env python
#coding=utf-8

'''
Created on 2009-2-26

@author: zarra
'''

from sqlalchemy import  Column, Integer, String,Unicode,UnicodeText, DateTime, ForeignKey,Sequence
#from sqlalchemy.orm import relation, backref,eagerload,sessionmaker,scoped_session



from model.drug_post._base import Base


 
class Drug_Post(Base):
    __tablename__ = 'drug_post'
   
    id               = Column('id',Integer,Sequence('drug_post_seq',1,1),primary_key=True,autoincrement=True)
    patient_id       = Column('patient_id',String(32),nullable=False)
    last_modify_time = Column('last_time',DateTime,nullable=False)
    drugs            = Column('drugs',UnicodeText,nullable=False)
    #context          = Column('context',UnicodeText,nullable=False)
    fields           = Column('fields',UnicodeText,nullable=False)
    
    def __json__(self):
        return {'id'      : self.id,\
                'patient_id':self.patient_id,\
                'last_modify_time':self.last_modify_time,\
                'drugs':self.drugs,\
                'fields':self.fields}
    
    